/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
struct ListNode* deleteDuplicates(struct ListNode* head) {
    if(head == NULL)
        return head;
    struct ListNode* phead = head;
    while(phead->next){
        if(phead->val == phead->next->val){
            struct ListNode* node = phead->next;
            phead->next = node->next;
            free(node);
        }else{
            phead = phead->next;
        }
    }
    return head;
}

/*给定一个已排序的链表的头 head 删除所有重复的元素，使每个元素只出现一次。返回已排序的链表。*/